import request from '@/axios';

export const getList = (current, size, sort, params) => {
  const cryptoData = JSON.stringify(params);
  return request({
    url: '/biz/sms/service-country-mapping/list',
    method: 'post',
    params: {
      current,
      size,
      ...sort
    },
    data: { cryptoData: cryptoData },
    cryptoToken: true,
    cryptoData: true
  });
};

export const getPage = (current, size, sort, data) => {
  return request({
    url: '/biz/sms/service-country-mapping/page',
    method: 'post',
    params: {
      current,
      size,
      ...sort
    },
    data: data,
    cryptoToken: true,
    cryptoData: true
  });
};

export const getDetail = (id) => {
  return request({
    url: '/biz/sms/service-country-mapping/detail',
    method: 'post',
    data: { id: id },
    cryptoToken: true,
    cryptoData: true
  });
};

export const remove = (ids) => {
  return request({
    url: '/biz/sms/service-country-mapping/remove',
    method: 'post',
    data: { ids: ids },
    cryptoToken: true,
    cryptoData: true
  });
};

export const add = (row) => {
  return request({
    url: '/biz/sms/service-country-mapping/save',
    method: 'post',
    data: row,
    cryptoToken: true,
    cryptoData: true
  });
};

export const update = (row) => {
  return request({
    url: '/biz/sms/service-country-mapping/update',
    method: 'post',
    data: row,
    cryptoToken: true,
    cryptoData: true
  });
};

export const countrySync = (serviceApiId, serviceConfigId) => {
  return request({
    url: '/biz/sms/service-country-mapping/country-sync',
    method: 'post',
    data: { serviceApiId: serviceApiId, serviceConfigId: serviceConfigId },
    cryptoToken: true,
    cryptoData: true
  });
};

export const operatorSync = (serviceApiId, serviceConfigId) => {
  return request({
    url: '/biz/sms/service-country-mapping/operator-sync',
    method: 'post',
    data: { serviceApiId: serviceApiId, serviceConfigId: serviceConfigId },
    cryptoToken: true,
    cryptoData: true
  });
};

export const priceSync = (serviceApiId, serviceConfigId) => {
  return request({
    url: '/biz/sms/service-country-mapping/price-sync',
    method: 'post',
    data: { serviceApiId: serviceApiId, serviceConfigId: serviceConfigId },
    cryptoToken: true,
    cryptoData: true
  });
};
